
package Interfeis;

import sdljava.event.*;
        
public class evento {
  
  sdljava.event.SDLEvent event=null;
       
  pad    jostic[]      = new pad[6]    ;
  
  public keyPad key_control[] = new keyPad[4] ;
  public raton raton_control;
    
  int keyPad_count=0;
  int jostic_count=0;
  int raton_count=0;
    
  public evento() {    
 
  }
  
  public void Ini_key(){ 
  }
  
  public void Ini_keypad()
  {      
   key_control[keyPad_count]=new keyPad();  
   keyPad_count++;
  }   
  
  public void Ini_raton() { 
    raton_control=new raton();
    raton_count++;
  }   
  public void Ini_jostic(){ 
  }   
       
      
  public void mirar() 
  {  
   int i;
   int tecl;
   int butt;
   
   try{   
      event=event.pollEvent();
  
   if (event!=null) 
     {    
      if(event.getType()==sdljava.event.SDLKeyboardEvent.SDL_KEYDOWN)
        {
         tecl = ((sdljava.event.SDLKeyboardEvent)event).getSym(); 
         for(i=0;i<keyPad_count;i++) key_control[i].Actualiza(tecl);  
         
        }
    
      if(event.getType()==sdljava.event.SDLKeyboardEvent.SDL_KEYUP)
        {
         tecl = ((sdljava.event.SDLKeyboardEvent)event).getSym(); 
         for(i=0;i<keyPad_count;i++) key_control[i].Actualiza(tecl);   
        }
      try{
       if(event.getType()==sdljava.event.SDLMouseButtonEvent.SDL_MOUSEBUTTONDOWN){
            butt=((sdljava.event.SDLMouseButtonEvent)event).getButton();
            raton_control.Actualiza(butt);
       }
  
       if(event.getType()==sdljava.event.SDLMouseButtonEvent.SDL_MOUSEBUTTONUP){
            butt=((sdljava.event.SDLMouseButtonEvent)event).getButton();
            raton_control.Actualiza(butt);
       }
        }catch(NullPointerException exc){}
      }
  
        
   }catch (sdljava.SDLException exc1){} ;  
  }
    
}
